package com.pcbly.web.components.utils.template.pagemess;

import java.lang.reflect.Field;

import com.pcbly.web.bean.system.ModuleBean;
import com.pcbly.web.components.utils.template.TemplateModel;
 
public class ModelPageAndMessage extends IModelPageAndMessage { 
	
	/* (non-Javadoc)
	 * @see com.pcbly.web.components.utils.template.IModelPageAndMessage#execute(java.lang.Class)
	 */
	public void execute(Class<?> clz) {
		try {
			TemplateModel model = new TemplateModel();
			model.setClz(clz);
			model.setClzName(clz.getName());

			Field[] fields = clz.getDeclaredFields();
			Field[] tempFields = new Field[fields.length - 1];
			int i = 0;
			for (Field field : fields) {
				if (!(field.getName().equals("serialVersionUID")
						|| field.getName().equals("endDate") || field.getName()
						.equals("startDate"))) {
					tempFields[i] = field;
					i++;
				}
			}
			execute(model, tempFields);

		} catch (Exception e) {

		}
	} 

	public static void main(String[] args) {
		System.out.println("Begin...................");
		IModelPageAndMessage model = new ModelPageAndMessage();
		model.execute(ModuleBean.class);
		System.out.println("End...................");
	}
}
